﻿@using SwashbucklerDiary.IServices
@namespace SwashbucklerDiary.Components

<MDialog Value="true"
         ContentClass="rounded-lg"
         Persistent="true"
         MaxWidth="420">
    <MCard>
        <MCardTitle Class="font-weight-bold">
            <MIcon Class="error--text mr-2">
                mdi-close-circle-outline
            </MIcon>
            @(I18n.T("ErrorHandle.Title"))
        </MCardTitle>
        <MCardText Class="pb-0">
            @(I18n.T("ErrorHandle.Content"))
        </MCardText>
        <MCardActions>
            <MSpacer></MSpacer>
            <MButton Text="true"
                     Color="red"
                     OnClick="Quit">
                @(I18n.T("Share.Quit"))
            </MButton>
        </MCardActions>
    </MCard>
</MDialog>

@code {
    [Inject]
    private II18nService I18n { get; set; } = default!;

    [Inject]
    private IPlatformService PlatformService { get; set; } = default!;

    private void Quit()
    {
        PlatformService.QuitApp();
    }
}